package com.crcc.common.exception;

public class BaseException extends Exception{

    private String resCode;
    private String resMessage;
    private ResultBody resultBody;

    public BaseException(ResultBody resultBody, Throwable e) {
        super(e);
        this.resultBody = resultBody;
    }

    public BaseException(String message, Throwable t) {
        super(message, t);
    }

    public BaseException(String resCode, String resMessage) {
        super(resCode + "," + resMessage);
        this.resCode = resCode;
        this.resMessage = resMessage;
    }

    public BaseException(Throwable e) {
        super(e);
    }

    public BaseException(String resMessage) {
        super(resMessage);
        this.resMessage = resMessage;
    }

    public BaseException(String resCode, String resMessage, Throwable e) {
        super(e);
        this.resCode = resCode;
        this.resMessage = resMessage;
    }

    @Override
    public String getMessage() {
        if (null != super.getMessage() && !"".equals(super.getMessage())) {
            return this.getResMessage();
        }
        return super.getMessage();
    }

    public String getResCode() {
        return resCode;
    }

    public void setResCode(String resCode) {
        this.resCode = resCode;
    }

    public String getResMessage() {
        return resMessage;
    }

    public void setResMessage(String resMessage) {
        this.resMessage = resMessage;
    }

    public ResultBody getResultBody() {
        return resultBody;
    }

    public void setResultBody(ResultBody resultBody) {
        this.resultBody = resultBody;
    }
}
